﻿using System;
using System.Collections.Generic;
using System.ServiceModel;
using System.ServiceModel.Activation;
using Pku.BookStore.IServices;
using Pku.BookStore.Model;

namespace Pku.BookStore.Services
{
    [Serializable]
    [ServiceBehavior(IncludeExceptionDetailInFaults = true, ConcurrencyMode = ConcurrencyMode.Multiple)]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class FavoritesServices : IFavoritesServices
    {
        /// <summary>
        /// 获取实例名
        /// </summary>
        private DAL.FavoritesDAL favoritesDAL
        {
            get
            {
                return new DAL.FavoritesDAL();
            }
        }

        /// <summary>
        /// 增加收藏夹
        /// </summary>
        /// <param name="entity"></param>
        public int Add(FavoritesModel entity)
        {
            return favoritesDAL.Add(entity);
        }

        /// <summary>
        /// 修改收藏夹信息
        /// </summary>
        /// <param name="entity"></param>
        public bool Modify(FavoritesModel entity)
        {
            return favoritesDAL.Modify(entity);
        }

        /// <summary>
        /// 搜索
        /// </summary>
        /// <returns></returns>
        public List<FavoritesModel> Search(FavoritesParam param)
        {
            return favoritesDAL.Search(param);
        }

        /// <summary>
        /// 获取实体
        /// </summary>
        /// <param name="favoritesID"></param>
        /// <returns></returns>
        public FavoritesModel GetEntityById(int favoritesID)
        {
            return favoritesDAL.GetEntityById(favoritesID);
        }

        /// <summary>
        /// 是否存在
        /// </summary>
        /// <param name="Str">关键字</param>
        /// <returns></returns>
        public bool Exist(int BookID, int UserID)
        {
            return favoritesDAL.Exist(BookID, UserID);
        }

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="CategoryID"></param>
        /// <returns></returns>
        public bool Delete(int FavoritesID)
        {
            return favoritesDAL.Delete(FavoritesID);
        }

    }
}
